package top.malaoshi.netdisk.component;

import org.springframework.stereotype.Component;
import top.malaoshi.jdbc.KeyValueHandler;
import top.malaoshi.util.StringUtil;

@Component
public class RecordListKeyHandler implements KeyValueHandler {

    @Override
    public String handleKey(String key) {
        int pos = key.indexOf("_");
        String ret = key;
        if(pos == 1){
            ret = StringUtil.slice(key,"_",false);
        }
        return ret;
    }

    @Override
    public Object handleValue(Object value) {
        Object ret = value;
        if(value instanceof Long){
            ret = value.toString();
        }
        return ret;
    }
}
